23. 嵌套循环

Python:嵌套循环

Task Description:

完成这些操作后,请选中它们 —

Task List:

Task Feedback:

很棒! 嵌套循环是很重要的编程技能。

_请尝试更改程序以画出其他形状。下面是一个示例!_

请尝试更改程序以画出其他形状。下面是一个示例!

Workspace

This section contains either a workspace (it can be a Jupyter Notebook workspace or an online code editor work space, etc.) and it cannot be automatically downloaded to be generated here. Please access the classroom with your account and manually download the workspace to your local machine. Note that for some courses, Udacity upload the workspace files onto https://github.com/udacity , so you may be able to download them there.

Workspace Information:

  • Default file path:
  • Workspace type: html-live
  • Opened files (when workspace is loaded): n/a

备注 :如果你无法打开上面的workspace,请去 这里

以下代码使用了嵌套循环。turtle 总共将爬多远?

import turtle
anna = turtle.Turtle()
for path in [1, 2, 3, 4]:
    for step in [1, 2, 3]:
        anna.forward(10)
SOLUTION: 120 个像素